package itbour.onetouchshow.bean.canvas;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by zjl_d on 2017/11/22.
 * 贝塞尔曲线的路径
 */

public class PathsBean implements Serializable {
    private float w;
    private float h;
    private List<List<Float>> points;

    public PathsBean() {
    }

    public float getW() {
        return w;
    }

    public void setW(float w) {
        this.w = w;
    }

    public float getH() {
        return h;
    }

    public void setH(float h) {
        this.h = h;
    }

    public List<List<Float>> getPoints() {
        return points;
    }

    public void setPoints(List<List<Float>> points) {
        this.points = points;
    }

    public PathsBean editPathsBeanWithSize(float w, float h) {

        this.setW(w);
        this.setH(h);
        List<List<Float>> points = (List) new ArrayList<ArrayList<Float>>();
        this.setPoints(points);

        /**
         POD_TT_PRIM_NONE        = 0,
         POD_TT_PRIM_LINE        = 1,		// line to
         POD_TT_PRIM_QSPLINE     = 2,		// qudratic bezier to
         POD_TT_PRIM_CSPLINE     = 3,		// cubic bezier to
         POD_TT_PRIM_MOVE        = 8,		// move to
         POD_TT_PRIM_CLOSE       = 9,        // close path, equal to fisrt point of path
         * */
        // 左上
//        List<float> lt = pointWithXYAndType(0, 0, 8);
        ArrayList<Float> lt = pointWithXYAndType(0, 0, 8);
        points.add(lt);
        // 右上
        ArrayList<Float> rt = pointWithXYAndType(w, 0, 1);
        points.add(rt);
        // 右下
        ArrayList<Float> rb = pointWithXYAndType(w, h, 1);
        points.add(rb);
        // 左下
        ArrayList<Float> lb = pointWithXYAndType(0, h, 1);
        points.add(lb);
        // 闭合(左上)
        ArrayList<Float> close = pointWithXYAndType(0, 0, 9);
        points.add(close);

        return this;
    }

    public ArrayList<Float> pointWithXYAndType(float x, float y, float type) {

        ArrayList<Float> point = new ArrayList<Float>();
        point.add(x);
        point.add(y);
        point.add(type);

        return point;
    }


}
